<template>
  <div class="job-container">
    <xl-search-form :formItems="formItems" @search="search"></xl-search-form>
    <xl-table :columns="columns" :action="loadData" ref="xlTableRef">
      <template slot="name" slot-scope="{ row }">
        <span>{{ row.position.name }}</span>
      </template>
      <template slot="companyName" slot-scope="{ row }">
        <span>{{ row.company.fullName }}</span>
      </template>
      <template slot="enableStatus" slot-scope="{ row }">
        <span style="color: #67c23a" v-if="row.enableStatus === 1">招聘中</span>
        <span style="color: #f56c6c" v-else>停止招聘</span>
      </template>
      <template slot="action">
        <el-button type="text">编辑</el-button>
      </template>
    </xl-table>
  </div>
</template>

<script>
import { columns, formItemsFun } from './const'
import { getJobList } from '@/api/job'

export default {
  data() {
    return {
      columns
    }
  },
  computed: {
    formItems() {
      return formItemsFun()
    }
  },
  methods: {
    search(params) {
      this.$refs['xlTableRef'].loadData(params)
    },
    loadData(params) {
      return getJobList(params)
    }
  }
}
</script>

<style lang="scss" scoped></style>
